package com.blog.module.news.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.blog.common.mybatis.Page;
import com.blog.module.news.pojo.NewsInfo;
import com.blog.module.news.service.NewsInfoService;

  
 /**
 * @Title: NewsController.java
 * @Description: TODO
 * @author user
 * @date 2016年7月28日 下午2:42:05
 * @version V1.0
 */
@Controller
@RequestMapping("news/**")
public class NewsController {
 
	@Autowired
	private NewsInfoService newsInfoService;
	
	/**
	 * @Title: pageNewsList
	 * @Description: 查询新闻信息
	 * @param
	 * @return String
	 * @throws
	 */
	@RequestMapping(value="list.html")
	public String pageNewsList(Model model, NewsInfo newsInfo) {
		Page page = newsInfoService.pageNewsInfoList(newsInfo);
		model.addAttribute("page", page);
		return "admin/news/list";
	}
	
	
	/**
	 * @Title: newsInfo
	 * @Description: 新闻详情
	 * @param tags
	 * @return String
	 * @throws
	 */
	@RequestMapping("/{id}.html")
	public String newsInfo(@PathVariable Integer id,Model model) {
		NewsInfo newsInfo = newsInfoService.selectById(id);
		model.addAttribute("newsInfo",newsInfo);
		return "admin/news/list";
	}
}
